let app =  getApp();

  
Page({
  data:{
    nickname:"",
    avator:""
  },
  goLogin() {
    wx.navigateTo({
      url: '/pages/login/index',
    })
  },
  onLoad(){
    // this.getprofileInfo()
  },
  onShow(){
    this.getprofileInfo()
  },
  async getprofileInfo(){
    if (app.token) {
      const res = await wx.myRequest.get("/userInfo")
      this.setData({
        nickname: res.data.nickName,
        avator : res.data.avatar
      })
      
      app.profile = {
        ...res.data
      }
    }
   
  }
})
